Skip to content

upgradability: key rotation of the auditor public key #1026

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 17, 2025
Merged

upgradability: key rotation of the auditor public key #1026

merged 5 commits into from
Apr 17, 2025

Conversation

adecaro
Copy link
Contributor

@adecaro adecaro commented Mar 31, 2025

No description provided.

@adecaro adecaro changed the title F 1005 upgradability: key rotation of the auditor public key Mar 31, 2025
@adecaro adecaro linked an issue Mar 31, 2025 that may be closed by this pull request
@adecaro adecaro self-assigned this Apr 11, 2025
@adecaro adecaro linked an issue Apr 11, 2025 that may be closed by this pull request
@adecaro adecaro force-pushed the f-1005 branch 2 times, most recently from ed93e7a to c7ec9db Compare April 11, 2025 13:25
@adecaro adecaro linked an issue Apr 14, 2025 that may be closed by this pull request
Copy link
Contributor

@alexandrosfilios alexandrosfilios left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM modulo comments

for _, auditorSignature := range ctx.TokenRequest.AuditorSignatures {
auditor := auditorSignature.Identity
// check that issuer of this issue action is authorized
found := false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could do this like this

found := slices.Contains(auditors, auditorSignature.Identity.Equal)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay slices.ContainsFunc.

if err != nil {
return errors.Wrapf(err, "failed to deserialize auditor's public key")
}
_, err = ctx.SignatureProvider.HasBeenSignedBy(auditor, verifier)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand correctly, HasBeenSignedBy has to be called in the right order. Would it make sense to check in any order and keep a counter of how many have been checked already?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checking in any order is expensive because we would need to verify the signatures against multiple public keys.
Anyhow, a driver can use a different implementation of SignatureProvider as you suggest, sure.

@@ -248,13 +265,36 @@ func (v *Validator[P, T, TA, IA, DS]) verifyTransfer(tr TA, ledger driver.Ledger
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you mean if c >= 1?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, one time is okay.

Deserializer: v.Deserializer,
TransferAction: tr,
TransferAction: action,
Ledger: ledger,
SignatureProvider: signatureProvider,
MetadataCounter: map[MetadataCounterID]int{},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I don't find very neat here is that sometimes we pass a transfer action in the context, sometimes an issue action and sometimes none. I would pass none of them and then have different validator types:

type TransferValidator interface {
 Validate(Context, TransferAction)
}

Similarly for IssueValidator and AuditValidator

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this sounds like a task to add to the #930

}

func (r *AuditorSignature) FromProtos(tr *request.AuditorSignature) error {
if tr.Identity != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe also if tr == nil if it can happen

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wondering if we need to address this in another PR.

func newAuditingViewInitiator(tx *Transaction, local bool) *AuditingViewInitiator {
return &AuditingViewInitiator{tx: tx, local: local}
func newAuditingViewInitiator(tx *Transaction, local, skipAuditorSignatureVerification bool) *AuditingViewInitiator {
return &AuditingViewInitiator{tx: tx, local: local, skipAuditorSignatureVerification: skipAuditorSignatureVerification}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we include a testing feature in this view?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do you mean?

adecaro added 5 commits April 17, 2025 14:58
Signed-off-by: Angelo De Caro <[email protected]>
Signed-off-by: Angelo De Caro <[email protected]>
Signed-off-by: Angelo De Caro <[email protected]>
Signed-off-by: Angelo De Caro <[email protected]>
@adecaro adecaro merged commit 53eb259 into main Apr 17, 2025
55 checks passed
@adecaro adecaro deleted the f-1005 branch April 17, 2025 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

upgradability: key rotation of the auditor public key
2 participants